import request from '../utils/request'
import * as base from './modules/base'
import * as passport from './modules/passport'
import * as shop from './modules/shop'
import * as page from './modules/page'
import * as global from './modules/global'
import * as test from './modules/test'
import * as news from './modules/news'
import * as user from './modules/user'
import * as trade from './modules/trade'

const modules = {
  base,
  passport,
  shop,
  page,
  global,
  test,
  news,
  user,
  trade
}

const install = Vue => {
  if (install.installed) return
  install.installed = true
  Object.defineProperties(Vue.prototype, {
    axios: {
      get () {
        return request
      }
    },
    $http: {
      get () {
        return modules
      }
    }
  })
}

export default install
